import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import Layout from './components/Layout';
import Dashboard from './pages/Dashboard/Dashboard';
import Components from './pages/Components/index';
import ComponentVersions from './pages/ComponentVersions/ComponentVersions';
import GrayReleases from './pages/GrayReleases/GrayReleases';
import UserUpdates from './pages/UserUpdates/UserUpdates';
import UserVisits from './pages/UserVisits/UserVisits';
import './App.css';

function App() {
  return (
    <Router>
      <Routes>
        {/* 使用Layout组件作为所有页面的通用布局 */}
        <Route path="/" element={<Layout />}>
          <Route index element={<Dashboard />} />
          <Route path="components" element={<Components />} />
          <Route path="component-versions" element={<ComponentVersions />} />
          <Route path="gray-releases" element={<GrayReleases />} />
          <Route path="user-updates" element={<UserUpdates />} />
          <Route path="user-visits" element={<UserVisits />} />
          {/* 404路由 */}
          <Route path="*" element={<Navigate to="/" replace />} />
        </Route>
      </Routes>
    </Router>
  );
}

export default App;